home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / dvips / dosection.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-05  |  2.2 KB  |  99 lines

  1. /*
  2.  *  Code to output PostScript commands for one section of the document.
  3.  */
  4. #include "structures.h" /* The copyright notice in that file is included too! */
  5. #ifdef SYSV
  6. #include <string.h>
  7. #else
  8. #include <strings.h>
  9. #endif
  10. /*
  11.  *   These are the external routines we call.
  12.  */
  13. extern void dopage() ;
  14. extern void download() ;
  15. extern integer signedquad() ;
  16. extern void skipover() ;
  17. extern void cmdout() ;
  18. extern void numout() ;
  19. extern void newline() ;
  20. /*
  21.  *   These are the external variables we access.
  22.  */
  23. extern FILE *dvifile ;
  24. extern FILE *bitfile ;
  25. extern integer pagenum ;
  26. extern long bytesleft ;
  27. extern quarterword *raster ;
  28. extern int quiet ;
  29. extern Boolean reverse, multiplesects, disablecomments ;
  30. extern int actualdpi ;
  31. static int psfont ;
  32. /*
  33.  *   Now we have the main procedure.
  34.  */
  35. void
  36. dosection(s, c)
  37.         sectiontype *s ;
  38.         int c ;
  39. {
  40.    charusetype *cu ;
  41.    integer prevptr ;
  42.    int np ;
  43.  
  44.    cmdout("TeXDict") ;
  45.    cmdout("begin") ;
  46.    numout((integer)DPI) ;
  47.    cmdout("@start") ;
  48.    if (multiplesects)
  49.       cmdout("bos") ;
  50. /*
  51.  *   We insure raster is even-word aligned, because download might want that.
  52.  */
  53.    if (bytesleft & 1) {
  54.       bytesleft-- ;
  55.       raster++ ;
  56.    }
  57.    cu = (charusetype *) (s + 1) ;
  58.    psfont = 1 ;
  59.    while (cu->fd)
  60.       download(cu++, psfont++) ;
  61.    setup() ;
  62.    while (c > 0) {
  63.       c-- ;
  64.       prevptr = s->bos ;
  65.       if (! reverse)
  66.          (void)fseek(dvifile, (long)prevptr, 0) ;
  67.       np = s->numpages ;
  68.       while (np-- != 0) {
  69.          if (reverse)
  70.             (void)fseek(dvifile, (long)prevptr, 0) ;
  71.          pagenum = signedquad() ;
  72.          if (! quiet) {
  73. #ifdef SHORTINT
  74.             (void)fprintf(stderr, "[%ld", pagenum) ;
  75. #else  /* ~SHORTINT */
  76.             (void)fprintf(stderr, "[%d", pagenum) ;
  77. #endif /* ~SHORTINT */
  78.             (void)fflush(stderr) ;
  79.          }
  80.          skipover(36) ;
  81.          prevptr = signedquad()+1 ;
  82.          dopage() ;
  83.          if (! quiet) {
  84.             (void)fprintf(stderr, "] ") ;
  85.             (void)fflush(stderr) ;
  86.          }
  87.          if (! reverse)
  88.             (void)skipnop() ;
  89.       }
  90.    }
  91.    if (!disablecomments) {
  92.       newline() ;
  93.       (void)fprintf(bitfile, "%%%%Trailer\n") ;
  94.    }
  95.    if (multiplesects)
  96.       cmdout("eos") ;
  97.    cmdout("end") ;
  98. }
  99.